﻿<UserControl x:Class="Bewise.Phone.InfiniteList"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:Phone="clr-namespace:Bewise.Phone" mc:Ignorable="d"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    d:DesignHeight="480" d:DesignWidth="480">

    <Phone:ImprovedListBox x:Name="mainListBox"  SelectionChanged="mainListBox_SelectionChanged">
        <Phone:ImprovedListBox.Template>
            <ControlTemplate>
                <ScrollViewer x:Name="ScrollViewer" 
                                  BorderBrush="{TemplateBinding BorderBrush}" 
                                  BorderThickness="{TemplateBinding BorderThickness}" 
                                  Background="{TemplateBinding Background}" 
                                  Foreground="{TemplateBinding Foreground}" 
                                  Padding="{TemplateBinding Padding}"
                                  Loaded="ScrollViewer_Loaded">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="*"/>
                            <RowDefinition Height="80"/>
                        </Grid.RowDefinitions>
                        <ItemsPresenter/>
                    </Grid>
                </ScrollViewer>
            </ControlTemplate>
        </Phone:ImprovedListBox.Template>
        <Phone:ImprovedListBox.ItemContainerStyle>
            <Style TargetType="ListBoxItem">
                <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
                <Setter Property="HorizontalAlignment" Value="Stretch" />
                <Setter Property="VerticalContentAlignment" Value="Stretch"/>
            </Style>
        </Phone:ImprovedListBox.ItemContainerStyle>
    </Phone:ImprovedListBox>
</UserControl>
